import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { MongooseModule } from '@nestjs/mongoose';
import { PassportModule } from '@nestjs/passport';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { AuthModule } from './auth/auth.module';
import { UsersModule } from './users/users.module';
import { ProjectsModule } from './projects/projects.module';

// ConfigModule.forRoot 用于全局注入环境变量
@Module({
  imports: [AuthModule,
    UsersModule,
    PassportModule.register({ defaultStrategy: 'jwt' }),
    ConfigModule.forRoot({ isGlobal: true }),
    MongooseModule.forRoot(process.env.MONGODB_URL),
    ProjectsModule],
  controllers: [AppController],
  providers: [AppService],
  exports: [PassportModule.register({ defaultStrategy: 'jwt' })]
})
export class AppModule {

}